
<?php

class pra {

    public function __construct() {
        $dbhost = 'localhost';
        $dbuser = 'root';
        $dbpass = 'root';
        $dbname = 'dbpasantiaeam';
        mysql_connect($dbhost, $dbuser, $dbpass);
        mysql_select_db($dbname);
    }

    public function buscarPra($codPra) {
        $datos = array();
        $sql = "SELECT
    practica.nombrepra
    , empresa.nombre
    , empresa.nit
    , practica.idpractica
FROM
    dbpasantiaeam.practica
    INNER JOIN dbpasantiaeam.empresa
        ON (practica.empresa = empresa.nit) WHERE practica.idpractica LIKE '%$codPra%'";

        $resultado = mysql_query($sql);
        while ($row = mysql_fetch_array($resultado, MYSQL_ASSOC)) {
            $datos[] = array("value" => $row['idpractica'],
                "nom_prac" => $row['nombrepra'],
                "empresa_vinculada" => $row['nombre'],
                "emp_nit" => $row['nit']);
        }
        return $datos;
        mysql_close();
    }

}

?>
